import request from "@/utils/request.js";

/**
 * 分页查询题目
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const queryQuestionPage = (data) => {
  return request.post('/admin/question/page', data);
};

/**
 * 通过id查询题目
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const queryQuestionById = (data) => {
  return request.get('/admin/question/' + data);
};

/**
 * 新增题目
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const saveQuestion = (data) => {
  return request.post('/admin/question', data);
};

/**
 * 删除题目
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const removeQuestion = (data) => {
  return request.delete('/admin/question', { data });
};

/**
 * 更新题目
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const updateQuestion = (data) => {
  return request.put('/admin/question', data);
};

/**
 * 通过应用id查询题目
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const queryQuestionsByAppId = (data) => {
  return request.get('/admin/question/app/' + data);
};
